package cn.stylefeng.guns.modular.business.service;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.business.entity.UserTransactionLog;
import cn.stylefeng.guns.modular.business.model.dto.TransactionLogDTO;
import cn.stylefeng.guns.modular.business.model.params.UserTransactionLogParam;
import cn.stylefeng.guns.modular.business.model.result.UserTransactionLogResult;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户交易记录 服务类
 * </p>
 *
 * @author pzp
 * @since 2019-08-03
 */
public interface UserTransactionLogService extends IService<UserTransactionLog> {

    /**
     * 新增
     *
     * @author pzp
     * @Date 2019-08-03
     */
    void add(UserTransactionLogParam param);

    /**
     * 删除
     *
     * @author pzp
     * @Date 2019-08-03
     */
    void delete(UserTransactionLogParam param);

    /**
     * 更新
     *
     * @author pzp
     * @Date 2019-08-03
     */
    void update(UserTransactionLogParam param);

    /**
     * 查询单条数据，Specification模式
     *
     * @author pzp
     * @Date 2019-08-03
     */
    UserTransactionLogResult findById(Integer orderId);

    /**
     * 查询单条数据，Specification模式
     *
     * @author pzp
     * @Date 2019-08-03
     */
    UserTransactionLogResult findBySpec(UserTransactionLogParam param);

    /**
     * 查询列表，Specification模式
     *
     * @author pzp
     * @Date 2019-08-03
     */
    List<UserTransactionLogResult> findListBySpec(UserTransactionLogParam param);

    /**
     * 查询分页数据，Specification模式
     *
     * @author pzp
     * @Date 2019-08-03
     */
    LayuiPageInfo findPageBySpec(String type, String payMode, String state, String beginTime, String endTime);

    /**
     * 提现记录
     *
     * @param transactionLogDTO
     * @return
     */
    Page<UserTransactionLogResult> record(TransactionLogDTO transactionLogDTO);

    /**
     * 提现
     *
     * @param userId
     * @return
     */
    Map<String, Object> cashOut(Long userId);

    /**
     * 确认提现
     *
     * @param userId  用户id
     * @param orderNo 订单号
     * @param money   金额
     * @param payMode 支付方式
     * @param account  账户
     */
    void confirmCashOut(Long userId, String orderNo, BigDecimal money, Integer payMode, String account);

}
